package guzb.cnblogs.classloader.third;

import java.util.ArrayList;
import java.util.List;

/**
 * 第三方接口样例-2
 *
 * @author 顾志兵
 * @mail ipiger@163.com
 * @since 2024-05-18
 */
public class SampleApi {

    /**
     * 检查设备信息
     * @param deviceNo 设备编号
     */
    public SampleDevice checkDevice(String deviceNo) {
        SampleDevice device = new SampleDevice();
        device.setSid("GUWD5320P001");
        device.setRegion("西南");
        device.setStatus(DeviceStatus.RUNNING);
        device.setUsage("市排水给水流量监测");

        List<SocketSlot> slots = new ArrayList<>();
        SocketSlot slot = new SocketSlot(1, 4);
        slot.connect(new Socket(1, SocketType.POWER, "EBS-9527"));
        slots.add(slot);

        slot = new SocketSlot(2, 6);
        slot.connect(new Socket(1, SocketType.CONTROL, "CTR-0709"));
        slot.connect(new Socket(2, SocketType.CONTROL, "CTR-0310"));
        slot.connect(new Socket(3, SocketType.MAIN_WAVEFORM, "WVE-15218"));
        slots.add(slot);

        slot = new SocketSlot(3, 12);
        slot.connect(new Socket(1,SocketType.MONITOR, "MTR-709817"));
        slot.connect(new Socket(2,SocketType.MONITOR, "MTR-3572"));
        slot.connect(new Socket(3,SocketType.MONITOR, "MTR-709817"));
        slot.connect(new Socket(4,SocketType.MONITOR, "MTR-709817"));
        slot.connect(new Socket(5,SocketType.MONITOR, "MTR-709817"));
        slot.connect(new Socket(6,SocketType.MONITOR, "MTR-709817"));
        slots.add(slot);

        device.setSocketSlots(slots);

        return  device;
    }
}
